home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Environment Additions / Symantec / Additions / SOM (SPM) / CodeFragmentSearch.h next >
Encoding:
C/C++ Source or Header  |  1995-10-27  |  6.6 KB  |  170 lines  |  [TEXT/MPS ]

  1.  
  2. #ifndef __CodeFragSearch__h__
  3. #define __CodeFragSearch__h__
  4.  
  5. #include <CodeFragments.h>
  6.  
  7. #ifdef __CFM68K__
  8. #pragma import on
  9. #endif
  10.  
  11. // This file defines the Code Fragment Search functions.
  12. // At some point in the future, this file may be merged with CodeFragments.h
  13. // The functions declared in this file are defined and supplied along with SOM.
  14. // Link with the SOM Kernel shared library file to satisfy the linker.
  15. // The SOM "fat" shared library must be installed (in the extensions folder) 
  16. // in order to use these search functions.
  17.  
  18. // This is the 'cfrg' resource member extension template definition.
  19. // It is added to the end of the existing data in the cfrg entry.
  20. // Note that the end of the existing cfrg entry includes the
  21. // padding to bring it up to a longword boundary; this data
  22. // is layed out after the longword padding (if any).
  23. // The length in the memberSize field of the existing
  24. // entry accounts for this addition.  This extension also
  25. // is aligned up to a longword boundary.  The length specified
  26. // by memberSize includes all of: the length of the initial
  27. // cfrg entry as described in CodeFragmentTypes.r, which includes
  28. // padding to bring that part up to a longword boundary, the
  29. // length of the member extension (if present) and any padding
  30. // needed to bring the extension up to a longword boundary.
  31.  
  32. #define kXTCFRGMagic 0x30ee
  33.  
  34. typedef struct {
  35.     unsigned short magic;            // 0x30ee
  36.     unsigned short exLength;        // length of extension member
  37.     OSType   libraryKind;            // see common types listed below
  38.     unsigned char  className [4];    // Packed Str255s start here:
  39.                                     // Str255 className;
  40.                                     // Str255 qualifier;
  41.                                     // Str255 infoStr;
  42.                                     // Str255 intlName;
  43. } XtCfrg, *XtCfrgPtr;
  44.  
  45.  
  46.  
  47. // This is the CFM API search function return struct layout
  48.  
  49.     struct FragSearchItem {
  50.         OSType  archType;            // processor architecture
  51.         OSType  libraryKind;        // major library catagory
  52.         
  53.                                     // offset(s) are relative to stringBase at beginning of this block
  54.                                     // ie: use (StringPtr) (stringbase + baseClassNameOffset)
  55.  
  56.         long    baseClassNameOffset;// offset to base class name pstring
  57.         long    qualifierOffset;    // offset to qualifier pstring
  58.  
  59.         long    cfrgNameOffset;        // name to give GetSharedLibrary to load library (pstring)
  60.         long    infoStrOffset;        // extra info to help make decision (pstring)
  61.  
  62.         long    intlNameOffset;        // name to present to user in pop up choice list (pstring)
  63.  
  64.         short     dummy2a;            // padding
  65.  
  66.         short    fileVRefNum;        // the containing file's vRefNum
  67.         long    fileParID;            // the containing file's dirID
  68.         long    fileIndex;            // the file's directory entry valence #
  69.         
  70.         long    cfrgMemberOffset;    // offset from start of cfrg to start of cfrg member entry
  71.  
  72.         short    dummy2b;            // padding
  73.         
  74.         unsigned char    cfrgUsage;            // from cfrg usage field
  75.         unsigned char    cfrgWhere;            // from cfrg where field
  76.         long            cfrgOffset;            // from cfrg offset field
  77.         long            cfrgLength;            // from cfrg length field
  78.         unsigned long    cfrgCurrentVersion;    // from cfrg currentVersion field
  79.         unsigned long    cfrgOldDefVersion;    // from cfrg oldDefVersion field
  80.  
  81.         long    dummy4a;            // reserved for future use by Apple.
  82.         long    dummy4b;
  83.         long    dummy4c;
  84.         long     dummy4d;
  85.     };
  86.  
  87.     typedef struct FragSearchItem FragSearchItem, *FragSearchItemPtr;
  88.  
  89.  
  90. struct FragSearchBlk {
  91.     unsigned char    stringBase [2]; // "& stringBase [0]" is added to the offsets in 
  92.                                     // FragSearchItem to get to the pstrings...
  93.     unsigned short    count;            // the number of "candidates" below
  94.     long            dummy4;            // reserved for future use by Apple.
  95.     
  96.     FragSearchItem  foundItems [1];    // array of retured values
  97. };
  98.  
  99. typedef struct FragSearchBlk FragSearchBlk, *FragSearchPtr, **FragSearchHandle;
  100.  
  101.  
  102. // This OSType definitions define common values for libraryKind
  103. // The meaning of the baseClassName, qualifier, and returned infoStr
  104. // are based on the "libraryKind" selector.  For both OpenDoc parts,
  105. // and SOM class libraries, the baseClassName parameter is a real
  106. // SOM class name, and the use of the qualifier is not mandated.
  107. // For component manager libraries, the baseClassName designates
  108. // the component type and the qualifier designates the sub-type.
  109. // the returned infoStr gives additional data.
  110.  
  111. #define kFragAnyLibraryKind             0
  112. #define kFragDocumentPartHandler    'part'        // OpenDoc(TM) part handler
  113. #define kFragClassLibrary            'clas'        // general SOM(TM) class library
  114. #define kFragInterfaceDefinition    'libr'        // traditional library
  115. #define kFragComponentMgrLibrary    'comp'        // Component Manager component
  116.  
  117.  
  118. // FragFindInterfaces locates libraries that have extended cfrg entries.
  119. // It uses the currently active CFM search path to locate shared libraries.
  120. // Extended cfrg entries can be created/reported with the new version of MergeFragment
  121. // If any of the parameters in (archType,libraryKind,baseClassName,qualifier)
  122. //  supplied is literally 0 (null or zero, but not the empty string "\p" or "")
  123. //  then this indicates that a match of any value is desired.
  124. // Parameters are all case sensitive.
  125. // (This function will locate only libraries that have use an extended cfrg.)
  126. // NOTE: This function allocates memory in the current zone.  It also performs a
  127. // CFM search operation which may result in searching the current library search path 
  128. // for shared libraries.
  129. // Dispose of the results from FragFindInterfaces using FragDisposeSearchResults.
  130.  
  131.  
  132. pascal OSErr FragFindInterfaces ( OSType archType,
  133.                                   OSType libraryKind,
  134.                                   Str255 baseClassName, 
  135.                                     Str255 qualifier,
  136.                                    FragSearchHandle *results );
  137.  
  138.  
  139. // This version takes an FSSpec and performs the same searching, but only on the one file.  
  140. // (Note that the returned fileVRefNum, fileParID, and fileIndex members are not valid.)
  141. // Dispose of the results from FragFindInterfaces using FragDisposeSearchResults.
  142. pascal OSErr FragFindInterfacesInFile ( FSSpecPtr fileSpec,
  143.                                         OSType archType,
  144.                                         OSType libraryKind,
  145.                                         Str255 baseClassName, 
  146.                                         Str255 qualifier,
  147.                                         FragSearchHandle *searchHandlePtr );
  148.  
  149. // This version takes a cfrg entry (pointer) and performs the same searching, 
  150. // but only on the one cfrg entry.  
  151. // Be sure to lock the cfrg if it comes from a resource.
  152. // (Note that the returned fileVRefNum, fileParID, and fileIndex members are not valid.)
  153. // Dispose of the results from FragFindInterfaces using FragDisposeSearchResults.
  154. pascal OSErr FragFindInterfacesInCfrg ( XtCfrgPtr cfrgPtr,
  155.                                         OSType archType,
  156.                                         OSType libraryKind,
  157.                                         Str255 baseClassName, 
  158.                                         Str255 qualifier,
  159.                                         FragSearchHandle *results );
  160.  
  161.  
  162. // Dispose of the results from FragFindInterfaces... using FragDisposeSearchResults.
  163. pascal void FragDisposeSearchResults ( FragSearchHandle results );
  164.  
  165. #ifdef __CFM68K__
  166. #pragma import off
  167. #endif
  168.  
  169. #endif
  170.